package com.tjsinfo.tjsoa.fileExpress.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.addresslist.bo.IAddressListAndFilePendingBo;
import com.tjsinfo.tjsoa.fileExpress.bo.IFileExpressFileBo;
import com.tjsinfo.tjsoa.fileExpress.bo.IFileExpressUserSizeBo;
import com.tjsinfo.tjsoa.system.bo.ISystemUserBo;
import com.tjsinfo.tjsoa.system.vo.User;

public class LoginLeftAction extends Action{
	private IFileExpressUserSizeBo userEmailBo;
	private IFileExpressFileBo expressFileBo;
	private ISystemUserBo tjsUserBo;
	private IAddressListAndFilePendingBo addressListAndFilePendingBo;

	public void setAddressListAndFilePendingBo(
			IAddressListAndFilePendingBo addressListAndFilePendingBo) {
		this.addressListAndFilePendingBo = addressListAndFilePendingBo;
	}

	public void setTjsUserBo(ISystemUserBo tjsUserBo) {
		this.tjsUserBo = tjsUserBo;
	}

	public void setExpressFileBo(IFileExpressFileBo expressFileBo) {
		this.expressFileBo = expressFileBo;
	}

	public void setUserEmailBo(IFileExpressUserSizeBo userEmailBo) {
		this.userEmailBo = userEmailBo;
	}

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		request.setAttribute("first", "shi");
		
		HttpSession	session = request.getSession();
		User user = (User) session.getAttribute("user");
		
		expressFileBo.updateStateByUserId(Integer.valueOf(user.getUser_id()), String.valueOf(0));
		
		addressListAndFilePendingBo.deleteByUserIdAndTyle(user.getUser_id(), "文件速递");
		
		return mapping.findForward("ok");
	}
}
